Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
helpers.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Roc authors
3
*
4
* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
*/
8
9
//! @file roc_core/helpers.h
10
//! @brief Compile time helpers.
11
12
#ifndef ROC_CORE_HELPERS_H_
13
#define ROC_CORE_HELPERS_H_
14
15
//! Get number of elements in a static array.
16
#define ROC_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
17
18
//! Cast a member of a structure out to the containing structure.
19
#define ROC_CONTAINER_OF(ptr, type, member) \
20
(reinterpret_cast<type*>((char*)(ptr)-offsetof(type, member)))
21
22
//! Stringize macro helper.
23
#define ROC_STRINGIZE_(s) #s
24
25
//! Stringize macro.
26
#define ROC_STRINGIZE(s) ROC_STRINGIZE_(s)
27
28
#endif
// ROC_CORE_HELPERS_H_
roc_core
helpers.h
Generated by
1.9.5